<!doctype html>
<html>

<head>
    <meta charset="utf-8">

    <title>this</title>

    <!--     this:当前事件发生的对象
this常见错误：- window
定时器
attachEvent
包了一次
行间 -->

    <script>
        function show() {
            alert(this);
        }
        window.onload = function() {


            var aInput = document.getElementsByTagName("input");

            aInput[0].onclick = function() {
                show(); // win
            };

            aInput[1].onclick = show; //input

            aInput[2].onclick = function() {
                setTimeout(show, 1000); //win 
            };

            aInput[aInput.length - 1].attachEvent("onclick", show); //win



        };
    </script>
</head>

<body>
    <input type="button" value="按钮0" />
    <input type="button" value="按钮1" />
    <input type="button" value="按钮2" />
    <input type="button" value="按钮3" onclick="show();" />
    <input type="button" value="按钮4" />

</body>

</html>
